package rrrmai.viewmodel;

import android.arch.lifecycle.ViewModel;
import java.util.List;
import javax.inject.Inject;
import io.reactivex.Flowable;
import rrrmai.repository.PostRepository;
import rrrmai.viewbinder.Post;

/**
 * Created by summer on 2018/3/20.
 */
public class PostsViewModel  extends ViewModel{


    protected PostRepository postRepo;

    @Inject
    public PostsViewModel(PostRepository postRepo) {
        this.postRepo=postRepo;
    }

    public Flowable<List<Post>> getPostList(int page, int pageSize) {
        return postRepo.getPostList(page,pageSize);
    }

    public Long[] insert(Post ... post) {
         return postRepo.insert(post);
    }

    public int delete(Post ... post) {
       return postRepo.delete(post);
    }

    public int update(Post ... post) {
        return postRepo.update(post);
    }
}
